const path = require('path')
const CompressionPlugin = require("compression-webpack-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const  VueLoaderPlugin  = require('vue-loader/lib/plugin');

let plugins = [];

plugins.push(new VueLoaderPlugin());

module.exports = {
    mode:'production',
    resolve: {
        alias: {
            vue: 'vue/dist/vue.common.js'
        }
    },
    module: {
        rules: [

            {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader'
                }
            },
            {
                test: /\.css$/,
                use: ['css-loader']
            }
        ]
    },

    entry: './src/index.js',

    output: {
        path: path.resolve(__dirname, './dist'),
        library: 'VueDragResize',
        filename: '[name].js',
        libraryTarget: 'umd'
    },

    optimization: {
        minimizer: [
            new UglifyJsPlugin({
                sourceMap: false
            })
        ]
    },

    plugins: plugins

};